<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">


	$(function() {
		comlun();
		pie();
	});
	function comlun(){
		$.ajax({
			type:'post',
			dataType:'json',
			url:'${ctx}/voter/getColumn',
			data:{
				"id":$('#id').val()
			},
			success:function(data){
				var highchar = data.str;
				
				highchar = $.parseJSON(highchar);
	   			$('#container').highcharts(highchar);
	   			
	   			var los = data.lo;
	   			$.each(los,function(i,lo){
	   				var s = '';
	   				s+='<tr>'+
							'<td>'+lo.name+'</td>'+
							'<td>'+lo.voters+'</td>'+
							'<td>'+lo.lv+'</td>'+
						'</tr>';
	   				$('#tb').append(s);
	   			});
			},
			error:function(){
				alert("请求超时");
			}
		});
	}
	
	function pie(){
		$.ajax({
			type:'post',
			dataType:'json',
			url:'${ctx}/voter/getPie',
			data:{
				"id":$('#id').val()
			},
			success:function(data){
				data = $.parseJSON(data);
				$('#pie').highcharts(data);
			}
		});
	}
	
	
</script>

<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
		<form id="userAddForm" method="post">
			<input type="hidden" id="id" value="${id }"/>
			<table class="grid">
				<tr height="300px">
					<td colspan="2" valign="top" align="center">
						<div id="container" style="min-width: 310px; height: 300px; margin: 0 auto"></div>
					</td>
				</tr>
				
				<tr height="280px">
					<td align="center">
						<div id="pie" style="min-width: 310px; height: 280px; max-width: 310px; margin: 0 auto"></div>
					</td>
					<td align="center" valign="top">
						<table class="grid">
							<thead>
								<tr>
									<th>候选人</th>
									<th>得票数</th>
									<th>得票率</th>
								</tr>
							</thead>
							<tbody id="tb">
								
							</tbody>
						</table>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
